package cn.edu.cqupt.cxcy.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.cqupt.cxcy.dto.TeamImpl;

/**
 * Servlet implementation class TeamMemberDelete
 */
@WebServlet("/TeamMemberDelete")
public class TeamMemberDelete extends HttpServlet {
	private static final long serialVersionUID = 1L;
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
		int memberId= Integer.valueOf(request.getParameter("id"));
		TeamImpl impl = new TeamImpl();
		PrintWriter out = response.getWriter();
	    boolean mem_delete = impl.deleteTeamMenber(memberId);
	    if(mem_delete){
	    	out.write("{\"response\":0,\"mem_delete\":"+mem_delete+"}");
	    	out.flush();
	    }
        out.close();
}
}
